home *** CD-ROM | disk | FTP | other *** search
/ UpTime Volume 1 #1 / utv1n1s1.d64 / brain teasers (.txt) next >
Encoding:
Commodore BASIC  |  1988-01-01  |  7.5 KB  |  274 lines

  1. 10 rem                   brain tease
  2. 20 rem              george richard decker
  3. 30 rem               251 n. luzerne ave.
  4. 40 rem                balto., md. 21224
  5. 50 rem                    4/18/85
  6. 60 rem
  7. 70 poke54296,15:poke54273,110:poke54277,0:poke54278,8
  8. 80 poke54287,8:poke54286,1:poke54291,0:poke54292,8
  9. 90 rem set up sound registers
  10. 100 :
  11. 110 rem select game
  12. 112 :
  13. 115 uptime=(8*4096)+4: de=186
  14. 120 printchr$(8)chr$(14)
  15. 125 poke53280,14:poke53281,0: gosub 3200
  16. 130 print""spc(13)"[159][194]rain [212]easers"
  17. 140 printspc(11)"[150][212]he [200]ermit's [199]ame"
  18. 145 printspc(11)"[158][196]ecker's [212]owers"
  19. 150 printspc(11)"[153][195]ode [194]reaker"
  20. 152 printspc(8)"[155][208]ress the  [159] [211]pace [194]ar  "
  21. 154 printspc(4)"[155]for your [211]election and to [194]egin"
  22. 155 printspc(7)"[208]ress [158][198]8[155] to exit to [213]p[212]ime[155]"
  23. 156 printspc(16) "[155](c)1986": printspc(10) "by [199]. [210]ichard [196]ecker"
  24. 157 printspc(14) "[208]ublished by"
  25. 158 printspc(7) "[211]oftdisk [208]ublishing, [201]nc."
  26. 160 k=1272:poke198,0:gosub1290
  27. 162 poke k,62: for es=1to120
  28. 164 if peek(197)=60 then 190
  29. 166 get k$: if k$=chr$(140) then poke de,8: poke54296,0: sys uptime
  30. 170 next: gosub 1290: poke k,32: k=k+80: if k=1512 then k=1272
  31. 180 goto 162
  32. 190 if k=1272 then 230
  33. 200 if k=1352 then 580
  34. 210 goto910
  35. 215 :
  36. 220 rem start of game 1
  37. 222 :
  38. 230 getk$: gosub 3300: rem *** game inst. ***
  39. 231 :
  40. 232 get k$: if k$="" then 232
  41. 234 if k$=chr$(140) then poke de,8: poke54296,0: sys uptime
  42. 236 if k$<>chr$(32) then goto 232
  43. 238 :
  44. 240 fora=0to10:j(a)=0:next:j(1)=-80:j(2)=80:j(4)=-2:j(8)=2
  45. 242 poke53280,1:poke53281,1: print"[147]"chr$(142)
  46. 245 print"[147]"tab(12)"[156]the hermit's game":gosub1220
  47. 250 fora=0to4step2
  48. 260 forb=1322to1802step80:pokea+b,81:pokea+b+54272,9:next:next
  49. 270 fora=0to12step2:forb=1478to1638step80:pokea+b,81:pokea+b+54272,9:next:next
  50. 280 poke1564,87:poke55836,9:ar=1604:pokear,30:ma=0:t=31
  51. 290 if peek(197)=4 then run
  52. 295 get k$: if k$=chr$(140) then poke de,8: poke 54296,0: sys uptime
  53. 300 js=peek(56320):js=15-(jsand15):ifj(js)=0then340
  54. 310 d=j(js):ifpeek(d+ar-40)=32orpeek(d+ar-40)=160then340
  55. 320 pokear,32:ar=ar+j(js):pokear,30
  56. 330 ifpeek(197)=60then500
  57. 340 js=peek(56320)and16:ifjs=16thenfora=1to50:next:goto290
  58. 350 ifma=1then400
  59. 360 ifpeek(ar-40)=87thengosub1300:goto290
  60. 370 gosub1290:m1=ar-40:pokem1+54272,7:ma=1
  61. 380 js=peek(56320)and16:ifjs=0then380
  62. 390 goto290
  63. 400 c=peek(ar+54232)and15:ifc=7thenpokear+54232,9:ma=0:goto380
  64. 410 ifpeek(ar-40)=81thengosub1300:goto290ady.
  65. 420 m2=ar-40:aj=m1-m2
  66. 430 ifaj=160thenifpeek(m1-80)=81thenz=m1-80:goto480
  67. 440 ifaj=-160thenifpeek(m1+80)=81thenz=m1+80:goto480
  68. 450 ifaj=4thenifpeek(m1-2)=81thenz=m1-2:goto480
  69. 460 ifaj=-4thenifpeek(m1+2)=81thenz=m1+2:goto480
  70. 470 gosub1300:goto290
  71. 480 gosub1290:pokem1,87:pokem1+54272,9:pokem2,81:pokez,87:ma=0:t=t-1
  72. 490 ift=0then510
  73. 500 goto380
  74. 510 print"[144]very good!"
  75. 520 get k$: if k$="" then 520
  76. 530 if k$=chr$(140) then poke de,8: poke 54296,0: sys uptime
  77. 540 if k$<>chr$(133) then 520
  78. 550 run
  79. 560 rem
  80. 570 rem start of game 2
  81. 580 get k$: gosub 3500: rem *** game #2 inst. ***
  82. 581 :
  83. 582 get k$: if k$="" then 582
  84. 584 if k$=chr$(140) then poke de,8: poke 54296,0: sys uptime
  85. 586 if k$<>chr$(32) then 582
  86. 587 :
  87. 588 poke53280,1:poke53281,1
  88. 590 print"[147]": gosub 1220: printchr$(142)""spc(13)"decker's towers"
  89. 595 for a=1316to1876 step 40: poke a,118: poke a+54272,6: poke a+2,117
  90. 600 pokea+54274,6:pokea+7,118:pokea+54279,6:pokea+9,117:pokea+54281,6
  91. 610 pokea+14,118:pokea+54286,6:pokea+16,117:pokea+54288,6:next:z=49
  92. 620 fora=1317to1877step80:pokea,z:z=z+1:next:poke1237,3:poke1244,22:poke1251,2
  93. 630 c(1)=1317:c(2)=1964:c(3)=1971:j=0
  94. 640 print"[144]"tab(15)"1st. letter"
  95. 650 ifpeek(197)<>64then650
  96. 660 ifpeek(197)=20thenr=1:goto710
  97. 670 ifpeek(197)=31thenr=2:goto710
  98. 680 ifpeek(197)=28thenr=3:goto710
  99. 690 if peek(197)=4 then run
  100. 695 get k$: if k$=chr$(140) then poke de,8: poke 54296,0: sys uptime
  101. 700 goto660
  102. 710 gosub1290:print"[144]"tab(15)"2nd. letter"
  103. 720 ifpeek(197)<>64then720
  104. 730 ifpeek(197)=20thens=1:goto790
  105. 740 ifpeek(197)=31thens=2:goto790
  106. 750 ifpeek(197)=28thens=3:goto790
  107. 760 ifpeek(197)=60then640
  108. 770 ifpeek(197)=48thenrun
  109. 780 goto730
  110. 790 ifs=rthengosub1300:goto640
  111. 800 ifpeek(c(r))>peek(c(s))thengosub1300:goto640
  112. 810 gosub1290:pokec(s)-80,peek(c(r)):pokec(r),32:c(s)=c(s)-80:c(r)=c(r)+80
  113. 820 ifpeek(197)<>64then820
  114. 830 ifpeek(1324)=49orpeek(1331)=49then850
  115. 840 goto640
  116. 850 print"[144]very good!"
  117. 860 get k$: if k$="" then 860
  118. 870 if k$=chr$(140) then poke de,8: poke 54296,0: sys uptime
  119. 880 if k$<>chr$(133) then 860
  120. 890 run
  121. 900 rem end of game 2
  122. 902 :
  123. 904 rem start of game 3
  124. 906 :
  125. 910 get k$: gosub 3600: rem *** game #3 inst. ***
  126. 912 :
  127. 915 get k$: if k$="" then goto 915
  128. 920 if k$=chr$(140) then poke de,8: poke 54296,0: sys uptime
  129. 925 if k$<>chr$(32) then 915
  130. 927 :
  131. 930 print"[147]";: poke 53280,0: poke 53281,0
  132. 935 printchr$(142)spc(14)"[159]code breaker":fora=1064to1103
  133. 940 pokea,160:pokea+54272,14:next:fora=1192to1214:pokea,100:pokea+54272,14
  134. 950 pokea+800,99:pokea+55072,14:next:fora=1232to1952step40:pokea,101
  135. 960 pokea+54272,14:pokea+10,66:pokea+54282,14:pokea+16,66:pokea+54288,14
  136. 970 poke a+22,103: poke a+54294,14: next
  137. 972 :
  138. 974 gosub 3400: rem *** exit menu ***
  139. 976 :
  140. 980 print""tab(10)"number   right  pos.":tr=0
  141. 990 fora=1to5:n(a)=int(rnd(1)*10):next:print
  142. 1000 print"";
  143. 1010 for a=1to5: poke 198,0
  144. 1020 get s$: if s$="" then 1020
  145. 1025 if s$=chr$(140) then poke de,8: poke 54296,0: sys uptime
  146. 1030 if s$=chr$(133) then run
  147. 1035 if (s$<"0") or (s$>"9") then 1020
  148. 1040 print s$;: s(a)=val(s$): gosub 1290: next
  149. 1050 fora=1to5:t(a)=n(a):e(a)=s(a)::next:p=0:fora=1to5:ifs(a)=t(a)thenp=p+1
  150. 1060 next:r=0:fora=1to5:forb=1to5:ife(a)=t(b)thent(b)=-1:r=r+1:e(a)=-2
  151. 1070 next:next
  152. 1080 print""r""p:tr=tr+1
  153. 1090 iftr=18then1180
  154. 1100 ifp<5then1000
  155. 1110 print"[158]very":print"good!":print"you got":print"it in"
  156. 1120 print" "tr:print"trys."
  157. 1130 get k$: if k$="" then 1130
  158. 1140 if k$=chr$(140) then poke de,8: poke 54296,0: sys uptime
  159. 1150 if k$<>chr$(133) then 1130
  160. 1160 run
  161. 1180 gosub1300:print""tab(11) n(1);n(2);n(3);n(4);n(5):print"":goto1130
  162. 1190 rem end of game 3
  163. 1200 rem
  164. 1210 rem draw box sub.
  165. 1220 a=0:b=0
  166. 1230 forc=1154to1174:pokec+a,160:pokec+a+54272,6:next:forc=1213to1973step40
  167. 1240 pokec+b,160:pokec+b+54272,6:next:forc=1932to1914step-1:pokec+a,160
  168. 1250 pokec+a+54272,6:next:forc=1874to1194step-40:pokec+b,160:pokec+b+54272,6
  169. 1260 next:ifa=0thena=40:b=1:goto1230
  170. 1270 fora=0to16:forb=55508to56148step40:pokea+b,0:next:next
  171. 1275 gosub 3400: rem *** display exits ***
  172. 1280 return
  173. 1290 poke54276,17:poke54276,16:return
  174. 1300 poke54290,33:poke54290,32:return
  175. 3095 :
  176. 3096 rem *****************
  177. 3097 rem  clear text area
  178. 3098 rem *****************
  179. 3099 :
  180. 3100 bl$="                                      "
  181. 3110 for x=1to14
  182. 3120 printbl$
  183. 3130 next
  184. 3140 print"": return
  185. 3195 :
  186. 3196 rem ********
  187. 3197 rem  border
  188. 3198 rem ********
  189. 3199 :
  190. 3200 tl$="[176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174][157]"+chr$(148)+"[192]"
  191. 3210 ml$="[221]                                     [221][157]"+chr$(148)+" "
  192. 3215 br$="[171][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][179][157]"+chr$(148)+"[192]"
  193. 3220 bl$="[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][157]"+chr$(148)+"[192]"
  194. 3230 print"[147]";tl$
  195. 3240 for x=1to23: printml$: if x=17 then x=18: print br$
  196. 3245 next
  197. 3250 printbl$;"";
  198. 3260 return
  199. 3295 :
  200. 3296 rem ***************
  201. 3297 rem  game #1 inst.
  202. 3298 rem ***************
  203. 3299 :
  204. 3300 gosub 3100: rem *** clear text area ***
  205. 3302 :
  206. 3305 printspc(11)"[150][212]he [200]ermit's [199]ame[155]"
  207. 3310 print"    [213]sing your joystick in port 2,"
  208. 3320 print" leap the marbles until only one"
  209. 3330 print" marble remains. [208]osition the arrow"
  210. 3340 print" on the marble you wish to move and"
  211. 3350 print" press the fire button. [212]hen position"
  212. 3355 print" the arrow where you wish to move the"
  213. 3360 print" marble and again press the fire but-"
  214. 3365 print" ton. [212]he marble moves and the marble"
  215. 3370 print" that was jumped disappears."
  216. 3375 printspc(4)"[208]ress the  [159] [211]pace [194]ar  [146][155] to [208]lay"
  217. 3390 return
  218. 3395 :
  219. 3396 rem ***********
  220. 3397 rem  exit menu
  221. 3398 rem ***********
  222. 3399 :
  223. 3400 print"";
  224. 3405 co$="[129]": if k=1432 then co$="[155]"
  225. 3406 printco$
  226. 3410 printspc(33)"[176][192][192][192][192][174]"
  227. 3420 printspc(33)"[221] f1 [221]"
  228. 3430 printspc(33)"[173][192][192][192][192][189]"
  229. 3440 printspc(33)" menu"
  230. 3450 printspc(33)""
  231. 3460 printspc(33)"[176][192][192][192][192][174]"
  232. 3470 printspc(33)"[221] f8 [221]"
  233. 3480 printspc(33)"[173][192][192][192][192][189]"
  234. 3490 printspc(33)"uptime"
  235. 3492 return
  236. 3495 :
  237. 3496 rem ***************
  238. 3497 rem  game #2 inst.
  239. 3498 rem ***************
  240. 3499 :
  241. 3500 gosub 3100: rem *** clear text area***
  242. 3505 :
  243. 3510 printspc(12)"[158][196]ecker's [212]owers[155]"
  244. 3515 print"    [193] challenging adaptation of the"
  245. 3520 print" classic strategy game "chr$(34)"[212]owers of"
  246. 3525 print" [200]anoi"chr$(34)". [193]t the prompt for the 1st"
  247. 3530 print" letter, enter the tube's letter"
  248. 3535 print" where your 1st number is to come"
  249. 3540 print" from. [212]hen, at the prompt for the"
  250. 3545 print" 2nd letter, enter the tube's let-"
  251. 3546 print" ter where the number is to go."
  252. 3555 print" [210]emember, lesser[155] numbers go on top"
  253. 3560 print" of greater[155] numbers."
  254. 3570 printspc(4)"[208]ress the  [159] [211]pace [194]ar  [146][155] to [208]lay"
  255. 3580 return
  256. 3595 :
  257. 3596 rem ***************
  258. 3597 rem  game #3 inst.
  259. 3598 rem ***************
  260. 3599 :
  261. 3600 gosub 3100
  262. 3605 :
  263. 3610 print spc(14)"[153][195]ode [194]reaker[155]"
  264. 3615 print"    [217]our computer challenges you"
  265. 3620 print" to solve ([158]if you can[155]) the sequence"
  266. 3625 print" of 5 numbers it has generated and"
  267. 3630 print" kept to itself. [197]nter your first"
  268. 3635 print" guess and the machine will at least"
  269. 3640 print" let you know how many are correct"
  270. 3645 print" and how many are in the correct or-"
  271. 3650 print" der. [212]he rest is up to you!"
  272. 3655 printspc(5)"[208]ress the  [159] [211]pace [194]ar  [146][155]to [208]lay"
  273. 3660 return
  274.